package com.ruoyi.weiriya.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.weiriya.domain.WNonVipSetting;
import com.ruoyi.weiriya.domain.WVipSetting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 会员购买设置Mapper接口
 * 
 * @author lynn
 * @date 2023-08-01
 */
public interface WVipSettingMapper extends BaseMapper<WVipSetting>
{

    @Select("SELECT vs.*,a.name area_name,vct.type_value vehicle_type_name FROM w_vip_setting vs " +
            "LEFT JOIN w_area a on a.id = vs.area_id " +
            "RIGHT JOIN w_vehicle_charge_type vct on vs.vehicle_type = vct.id  ${ew.customSqlSegment}")
    List<WVipSetting> getChargeList(@Param(Constants.WRAPPER) QueryWrapper<WVipSetting> queryWrapper);

    @Select("SELECT vs.*,a.name area_name,vnct.type_value vehicle_type_name FROM w_vip_setting vs " +
            "LEFT JOIN w_area a on a.id = vs.area_id " +
            "RIGHT JOIN w_vehicle_non_charge_type vnct on vs.vehicle_type = vnct.id  ${ew.customSqlSegment}")
    List<WVipSetting> getDepositList(@Param(Constants.WRAPPER) QueryWrapper<WVipSetting> queryWrapper);

    @Select("SELECT vs.*,a.name area_name,vct.type_value vehicle_type_name FROM w_vip_setting vs " +
            "LEFT JOIN w_area a on a.id = vs.area_id " +
            "LEFT JOIN w_vehicle_charge_type vct on vs.vehicle_type = vct.id " +
            "WHERE vs.id = #{id}")
    WVipSetting getChargeWVipSettingById(String id);

    @Select("SELECT vs.*,a.name area_name,vnct.type_value vehicle_type_name FROM w_vip_setting vs " +
            "LEFT JOIN w_area a on a.id = vs.area_id " +
            "LEFT JOIN w_vehicle_non_charge_type vnct on vs.vehicle_type = vnct.id " +
            "WHERE vs.id = #{id}")
    WVipSetting getDepositWVipSettingById(String id);
}
